home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000133_icon-group-sender _Wed Jun 11 00:09:36 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 11 Jun 1997 10:41:18 MST
Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
id AA07916; Wed, 11 Jun 1997 10:41:17 -0700
To: icon-group@cs.arizona.edu
Date: 11 Jun 1997 00:09:36 GMT
From: bbadger@jade.ssd.hcsc.com (Bernard Badger)
Message-Id: <BBADGER.97Jun10200936@jade.ssd.hcsc.com>
Organization: Concurrent Computer Corp, Ft. Lauderdale, FL
Sender: icon-group-request@cs.arizona.edu
References: <Stuart.Robinson-1006972230400001@asianstmg-221.anu.edu.au>
Reply-To: bbadger@mail.ccur.com
Subject: Re: searching with variables
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1517
In article <Stuart.Robinson-1006972230400001@asianstmg-221.anu.edu.au> Stuart.Robinson@anu.edu.au (Stuart Robinson) writes:
> A quick question. If you wanted to use the function find() to search for
> a particular strings of characters, how would it be possible to define
> character variables? For example, suppose you want to search for the
> following sequences
>
> al
> el
> il
> ol
> ul
>
> which are really just Vl (where V stands for a vowel). Could you simply
> define a character set for vowels (V := 'aeiou') and then refer to that
> character set in the find() function? If so, what would it look like? I
> tried something like the following and it didn't work.
>
> find( V || "l")
>
> I realise it's a pretty trivial task but I don't have the manual at the
> moment and I'd like an answer within the next couple of days. Thanks in
> advance.
>
> --
> Stuart Robinson <Stuart.Robinson@anu.edu.au>
> The Australian National University
Well you don't (want to use find()).
Function find() only matches substrings.
Try this (based on "The Icon Programming Language" (1983), p 177):
procedure Vl(line)
static vowel
local line, i
initial vowel := 'aeiou'
i := 1
while i := upto(vowel,line,i) do {
suspend line[i+:2]
i += 2
}
end
procedure testVl()
local line
while line := read() do {
every write(Vl(line))
}
end
Sorry, it's untested and I can't easily test it myself.
--
Bernard A. Badger bbadger@mail.ccur.com
11. Thou shalt not Spam!